package com.mc.union;

import java.util.ArrayList;
import java.util.List;

public class DistinctCount {
	
	public static int distinctElementCount(int arr1[],int arr2[]) {
		List<Integer> list1 =new ArrayList<Integer>();
		for(int i=0; i<arr1.length; i++)
			if(list1.indexOf(arr1[i])==-1)
				list1.add(arr1[i]);
		List<Integer> list2 =new ArrayList<Integer>();
		for(int i=0; i<arr2.length; i++)
			if(list2.indexOf(arr2[i])==-1)
				list2.add(arr2[i]);
		int sum = list1.size()+list2.size();
		list1.retainAll(list2);
		return sum-2*list1.size();
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int arr1[] = {4,3,5,6};
		int arr2[] = {3,2,1,6,3,9,8,13};
		int sum = distinctElementCount(arr1, arr2);
		System.out.println(sum);
	}

}
